# -*- coding: utf-8 -*-
# @Time : 2019/1/10 14:37
# @Author : Administrator
# @File : bbb.py
# @Project : python
# @title : 接口测试 --- 登录
import requests,unittest,ddt
from woniuboss_interface.util.read_data import Read_Excel
from woniuboss_interface.common.login_decode import Login

data_li = Read_Excel()
ses,host,excel_path = Login()
@ddt.ddt
class Login(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        print("登录测试开始")
    @classmethod
    def tearDownClass(cls):
        print("登录测试完成")

    @ddt.data(*data_li.excel(excel_path,1))
    def test_login_001(self,data):
        response = requests.request("POST",host+"/log/userLogin",
                                  data = {"userName":data["userName"],"userPass":data["userPass"],"checkcode":data["checkcode"]})
        actual = response.text
        assert data["expect"] in actual

if __name__ == '__main__':
    unittest.main()